package com.gxuwz.leaveSystem.service;

import com.gxuwz.leaveSystem.dao.DepartmentDao;
import com.gxuwz.leaveSystem.entity.Department;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentService {

    private DepartmentDao departmentService;
    public void setDepartmentService(DepartmentDao departmentService) {
        this.departmentService = departmentService;
    }

    /**
     * 添加
     * @param dp
     * @return
     */
    public int add(Department dp){
        return departmentService.add(dp);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    public int delete(String id){
        return departmentService.delete(id);
    }

    /**
     * 修改
     * @param dp
     * @return
     */

    public int update(Department dp){
        return departmentService.update(dp);
    }

    /**
     * 根据id查列表
     * @param id
     * @return
     */

    public Department findByid(String id){
        return departmentService.findByid(id);
    }

    /**
     * 查询全部
     * @return
     */
    public List<Department> findAll(){
        return departmentService.findAll();
    }

    /**
     * 根据关键字搜索
     * @param keyword
     * @return
     */
    public List<Department> search(String keyword) {
        return departmentService.search(keyword);
    }
}
